#include <iostream>
#include <vector>
using namespace std;

int n,m;
vector<int> v[100000];

signed main()
{
    cin>>n>>m;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    for(int i=0;i<m;i++){
        int k,a[1000],flag = 1,vis[100000] = {0};
        cin>>k;
        for(int j=0;j<k;j++){
            cin>>a[j];
            vis[a[j]] = 1;
        }
        for(int j=0;j<k;j++){
            for(int p=0;p<v[a[j]].size();p++){
                if(vis[v[a[j]][p]]){
                    flag = 0;
                    break;
                }
            }
            if(flag==0)    break;
        }
        if(flag)    cout<<"Yes\n";
        else    cout<<"No\n";
    }
    return 0;
}
